home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Microsoft Visual Basic .NET
/
Programming Microsoft Visual Basic .NET (Microsoft Press)(X08-78517)(2002).bin
/
07 attributes
/
attributesdemo
/
customattribute.vb
< prev
next >
Wrap
Text File
|
2002-03-16
|
966b
|
37 lines
' The AttributeTargets.All value means that this attribute
' can be used with any program entity.
<AttributeUsage(AttributeTargets.All)> _
Class VersioningAttribute
' All attribute classes inherit from System.Attribute.
Inherits System.Attribute
' These should be Property procedures in a real application
' but fields are OK in this demo.
Public Author As String
Public Version As Single
Public Tested As Boolean
' The Attribute constructor takes two non-optional values.
Sub New(ByVal Author As String, ByVal Version As Single)
Me.Author = Author
Me.Version = Version
End Sub
End Class
' a class to test the Versioning attribute
<Versioning("John", 1.01)> _
Class TestClass
<Versioning("Robert", 1.01, Tested:=True)> _
Sub MyProc()
'
End Sub
<Versioning("Ann", 1.02)> _
Function MyFunction() As Long
'
End Function
End Class